@using Blazor.Diagrams.Core.Geometry
@using Blazor.Diagrams.Core.Extensions
@using CustomNodesLinks.Models

@{
  if (Label.ShowLabel)
  {
    @((MarkupString) $"<foreignObject class=\"graphml-link\" x=\"{X.ToInvariantString()}\" y=\"{Y.ToInvariantString()}\"><div style=\"font-size:16px;width:140px\" class=\"link-label\">{Label.Content}</div></foreignObject>")
  }
}

@code {

  [Parameter]
  public DiagramLinkLabel Label { get; set; }

  [Parameter]
  public Point Position { get; set; }

  private double X => Position.X + (Label.Offset?.X ?? 0);
  private double Y => Position.Y + (Label.Offset?.Y ?? 0);
}
